package bean;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class AddMemberDTO {

	private AddMemberVO amvo;
	private Connection conn;
	
	public AddMemberDTO() {
		conn = new MyOracle().getConn();
	}
	
	public boolean signup(){
		int a = 0;
		try {
			String sql = "insert into meminfo (MID, NICNAME, PWD, IRUM, BIRTH, GENDER, HEIGHT, KAKAOID, PHONE, PLACE, JOB, MARRY, PRIVATEINFO)"
					+ "values(?,?,?,?,?,?,?,?,?,?,?,?,?) ";
			
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, amvo.getMid());
			pst.setString(2, amvo.getNicname());
			pst.setString(3, amvo.getPwd());
			pst.setString(4, amvo.getIrum());
			pst.setString(5, amvo.getBirthday());
			pst.setString(6, amvo.getGender());
			pst.setString(7, amvo.getHeight());
			pst.setString(8, amvo.getKakao_id());
			pst.setString(9, amvo.getPhone());
			pst.setString(10, amvo.getPlace());
			pst.setString(11, amvo.getJob());
			pst.setString(12, amvo.getMarry());
			pst.setString(13, amvo.getPrivate_info());
			
			a= pst.executeUpdate();
			
		} catch (Exception e) {
			// TODO: handle exception
		}
		if(a == 0){
			return false;
		}
		else{
			return true;
		}
	}

	public AddMemberVO getAmvo() {
		return amvo;
	}

	public void setAmvo(AddMemberVO amvo) {
		this.amvo = amvo;
	}

	public Connection getConn() {
		return conn;
	}

	public void setConn(Connection conn) {
		this.conn = conn;
	}

}
